package nl.hu.verbrandendephoenix.controller;

import java.util.ArrayList;

import nl.hu.verbrandendephoenix.client.AppManager;
import nl.hu.verbrandendephoenix.client.NotificationManager;
import nl.hu.verbrandendephoenix.shared.Auction;
import nl.hu.verbrandendephoenix.shared.Bid;
import nl.hu.verbrandendephoenix.shared.FieldVerifier;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.TextBox;

public class BidStats {

	private nl.hu.verbrandendephoenix.view.BidStats bidStatsView;

	public BidStats() {
		bidStatsView = new nl.hu.verbrandendephoenix.view.BidStats();
	}

	public Panel getPanel(int acID) {
		AppManager.get().getRpcService().getAllBidsFromID(acID, new AsyncCallback<ArrayList<Bid>>() {

			public void onFailure(Throwable caught) {
				Window.alert("Communication Failure!");
			}

			public void onSuccess(ArrayList<Bid> result) {
				bidStatsView.createChart(result);
			} 
		});
		return bidStatsView.constructForm();
	}
}
